fix memory leaks in cup, easygps, mapsend, osm, pcx and skyforce exposed by test...
authortsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 2 Sep 2013 13:02:46 +0000 (13:02 +0000)
committertsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 2 Sep 2013 13:02:46 +0000 (13:02 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4588 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/easygps.cc
gpsbabel/internal_styles.cc
gpsbabel/mapsend.cc
gpsbabel/osm.cc
gpsbabel/pcx.cc
gpsbabel/raymarine.cc
gpsbabel/skyforce.cc
gpsbabel/style/cup.style

index 1a25c67a44be59a8e71a890d143fa82796c8a799..34f193f68f7fe78536db06037188cbef65d01206 100644 (file)
@@ -106,9 +106,14 @@ data_read(void)
         }
       }
       break;
-      case 7:
-        wpt_tmp->icon_descr = gbfgetpstr(file_in);
-        break;
+      case 7: {
+        char* id = gbfgetpstr(file_in);
+        wpt_tmp->icon_descr = id;
+        if (id) {
+          xfree(id);
+        }
+      }
+      break;
       case 8:  /* NULL Terminated (vs. pascal) descr */
         wpt_tmp->notes = gbfgetcstr(file_in);
         break;
index e007a88406c5d32c800f59462713d18d839b63a7..806959c09644930590a447051722703c6bbf8147 100644 (file)
@@ -82,6 +82,8 @@ static char cup[] =
   "#\n"
   "# (c) 2006, Robert Lipe, based on  sample files by Krzysztof Wojtas\n"
   "# Reference info: http://www.seeyou.ws/thankyou.php?fname=cup_format.pdf\n"
+  "# Reference info: http://download.naviter.com/docs/cup_format.pdf\n"
+  "# Reference info: http://www.keepitsoaring.com/LKSC/Downloads/cup_format.pdf\n"
   "#\n"
 
   "DESCRIPTION      See You flight analysis data\n"
@@ -98,7 +100,7 @@ static char cup[] =
   "EPILOGUE -----Related Tasks-----\n"
 
 
-  "IFIELD SHORTNAME,\"\", \"\"%s\"\"\n"
+  "IFIELD IGNORE,\"\", \"\"%s\"\"\n"
   "IFIELD SHORTNAME,\"\", \"%s\"\n"
   "IFIELD CONSTANT,\"\", \"\"\n"
   "IFIELD LAT_DDMMDIR, \"%f\", \"%08.3f\", \"absolute\"\n"
index 6aeb6c50e3a752df4d76623fa0fe1804fdb55545..6658f9c1035568f013c420cb1638fb9d7679c063 100644 (file)
@@ -360,7 +360,7 @@ mapsend_route_hdr(const route_head* rte)
 
   /* route name -- mapsend really seems to want something here.. */
   if (r.isEmpty()) {
-    rname = xstrdup("Route");
+    rname = "Route";
   } else {
     rname = rte->rte_name;
   }
index 75d31a896754d4aae0c3bb4d321218b0438ee865..475a598e23c2b091c605d1eaf582289f9eca9265 100644 (file)
@@ -433,7 +433,7 @@ osm_feature_ikey(const char* key)
 }
 
 
-static QString
+static char*
 osm_feature_symbol(const int ikey, const char* value)
 {
   char* result;
@@ -541,7 +541,11 @@ osm_node_tag(const char* args, const QXmlStreamAttributes* attrv)
     }
     wpt->shortname = xstrdup(str);
   } else if ((ikey = osm_feature_ikey(key)) >= 0) {
-    wpt->icon_descr = osm_feature_symbol(ikey, value);
+    char* id = osm_feature_symbol(ikey, value);
+    wpt->icon_descr = id;
+    if (id) {
+      xfree(id);
+    }
   } else if (strcmp(key, "note") == 0) {
     if (wpt->notes) {
       char* tmp;
index 297460548b7a983ef49bc350e48f2752c28e262a..e6d619274016e6f00cb72ae6e6032b7e38f501e9 100644 (file)
@@ -392,6 +392,7 @@ pcx_route_hdr(const route_head* rte)
   if (!cartoexploreur) {
     gbfprintf(file_out, "\n\nR  %s\n", name);
   }
+  xfree(name);
   gbfprintf(file_out, "\n"
             "H  IDNT   LATITUDE    LONGITUDE    DATE      TIME     ALT   DESCRIPTION                              PROXIMITY     SYMBOL ;waypts\n");
 }
index 6575f5eda9af3f69d57918911cbc8a384d0301d4..91f4801e32a1cff29f0d061f3a7e21366b2277bc 100644 (file)
@@ -436,7 +436,7 @@ static void
 enum_route_hdr_cb(const route_head* rte)
 {
   is_fatal(rte->rte_waypt_ct > 50,
-           MYNAME ": Routes with more than 50 points are not supported by Waymarine!");
+           MYNAME ": Routes with more than 50 points are not supported by Raymarine!");
 }
 
 static short_handle
index b13a4c7dafcfa834580c923c6ac73bf6d9b59ddc..50637c93307f60e81064bb2e18d6f775dc1c6f29 100644 (file)
@@ -197,6 +197,8 @@ skyforce_waypt_disp_cb(const waypoint* wpt)
       snprintf(buf + 2, sizeof(buf) - 2, "%03d ", rte_num);
     }
     snprintf(buf + 6, sizeof(buf) - 6, "%03d %-9s ", wpt_num, name);
+
+    xfree(name);
   }
 
 
index 7750de4df2d3a8d52a517a8c5b87808ce0121180..2803b760dbe03897888b1245533b772896e18a37 100644 (file)
@@ -1,6 +1,8 @@
 #
 # (c) 2006, Robert Lipe, based on  sample files by Krzysztof Wojtas
 # Reference info: http://www.seeyou.ws/thankyou.php?fname=cup_format.pdf
+# Reference info: http://download.naviter.com/docs/cup_format.pdf
+# Reference info: http://www.keepitsoaring.com/LKSC/Downloads/cup_format.pdf
 #
 
 DESCRIPTION      See You flight analysis data
@@ -17,7 +19,7 @@ PROLOGUE name,code,country,lat,lon,elev,style,rwdir,rwlen,freq,desc
 EPILOGUE -----Related Tasks-----
 
 
-IFIELD SHORTNAME,"", ""%s""
+IFIELD IGNORE,"", ""%s""
 IFIELD SHORTNAME,"", "%s"
 IFIELD CONSTANT,"", ""
 IFIELD LAT_DDMMDIR, "%f", "%08.3f", "absolute"